<template>
  <el-form class="el-form-left" label-position="left" :model="formData" :inline="true" label-suffix="：">

    <el-form-item :label="$getTextByLangKey('锡膏编号')">
      <el-input v-model="formData.code" style="width: 120px;" size="small"></el-input>
    </el-form-item>

    <el-form-item >
      <el-button type="primary" @click="handleSearch" size="small">{{$getTextByLangKey('查询')}}</el-button>
      <!--      <el-button style="margin-left: 4px" @click="handleClearSearch">{{$getTextByLangKey('清空')}}</el-button>-->
    </el-form-item>


    <el-form-item :label="$getTextByLangKey('库存统计(瓶)')">
      <el-input v-model="inventory" style="width: 120px;" disabled size="small"></el-input>
    </el-form-item>


  </el-form>
</template>
<script>

  import request from '@/common/js/request'

  export default {
    name: "pcba-record-filter",
    props:['inventory'],
    data() {
      return {
       formData: {
       },
        lineList:[]
      }
    },
    created: function () {
    },
    methods: {
      handleClearSearch(){
        this.formData.pcbaCode = ''
        this.formData.orderNo = ''
        this.formData.lineName = ''
        this.formData.createTimeEnd = ''
        this.formData.createTimeStart = ''
        this.handleSearch()
      },
      // 转换时间格式的formData
      getNewFormData(){
        const newFormData = {...this.formData}
        if(newFormData.createTimeEnd){
          newFormData.createTimeEnd = new Date(newFormData.createTimeEnd).getTime()
        }
        if(newFormData.createTimeStart){
          newFormData.createTimeStart = new Date(newFormData.createTimeStart).getTime()
        }
        return newFormData
      },
      handleSearch(){
        const newFormData = this.getNewFormData()
        this.$emit('search',newFormData)
      },

    }
  }

</script>

<style scoped>

  .el-form-left{
    padding: 10px;
  }

</style>
